var Page = function(){
    this.init();
};
Page.prototype = {
    params: {
        passport: '',
    },
    init: function(){
        this.initParams();
        this.initEvent();
    },
    initParams: function(){
        this.params.passport = Pub.getCookie('_PASSPORT');
        this.params.withdrawId = Pub.getSession('withdrawId');
    },
    getData: function(){
        var _this = this;
        var paramsObj = {
            passport: _this.params.passport,
            withdrawId:_this.params.withdrawId
        };
        Api.withdrawalauditdetails(paramsObj, function(data){
            console.log(data);
            $('#realName').val(data.realName);
            $('#money').val(data.money);
            $('#purpose').val(data.purpose);
            $('#purposeExplain').val(data.purposeExplain);
        });
    },
    submit:function(){
        var _this = this;
        $('.btDiv div').click(function(event) {
            var purpose=$('#purpose').val();
            var reply=$('#note').val();
            var state=$(this).attr('data');
            var paramsObj = {
                passport: _this.params.passport,
                withdrawId:_this.params.withdrawId,

                state:state,
                reply:reply
            };
            console.log(paramsObj);
            Api.withdrawalauditreply(paramsObj, function(data){
                console.log(data);
                layui.use('layer', function(){
                    layer.msg('操作成功', {icon: 6});
                    setTimeout(function(){
                        window.location.href = Pub.getHtmlUrl('./finance-withdrawal.html');
                    },1500)
                });
            });
        });
    },
    otherEvent:function(){
        var _this = this;
        $('.goods-checkbox input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        })
    },
    initEvent: function(){
        var _this = this;
        _this.getData();
        _this.submit();
        _this.otherEvent();


    }
};
var page = new Page();